//
//  KVOVC.m
//  demo
//
//  Created by chenzm on 2018/8/17.
//  Copyright © 2018年 chenzm. All rights reserved.
//

#import "KVOVC.h"
#import "Nure.h"

@interface KVOVC ()
///小孩
@property(nonatomic,strong)Chidren *child;
///护士
@property(nonatomic,strong)Nure *nure;

@end

@implementation KVOVC

#pragma mark - initial
- (void)viewDidLoad {
    [super viewDidLoad];
    [self initView];
}

#pragma mark - method
-(void)buttonClick:(UIButton *)sender{
    NSLog(@"开启键值观察者模式");
    [self removeObj];
    [self nure];
    self.testLabelText = @"开启键值观察者模式";
}

-(void)removeObj{
    _child = nil;
    _nure = nil;
}

#pragma mark - lazyload
-(Nure *)nure{
    if (!_nure) {
        _nure = [[Nure alloc]initWithChildren:self.child];
    }
    return _nure;
}

-(Chidren *)child{
    if (!_child) {
        _child = [[Chidren alloc]init];
    }
    return _child;
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
